﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp9
{
    public partial class Form1 : Form
    {
        int startingMileage, endingMileage;
        double mileTraveled, reimburseRate=.39, amountOwed;
        public Form1()
        {
            InitializeComponent();
        }

        private void review()
        {
            startingMileage = (int)startNum.Value;
            endingMileage = (int)endNum.Value;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            review();
            if(startingMileage>endingMileage)
            {
                MessageBox.Show("The starting mileage must be less than the ending mileage!", "Cannot Calculate");
                return;
            }
            mileTraveled = endingMileage -= startingMileage;
            amountOwed = mileTraveled *= reimburseRate;
            label4.Text = "$" + amountOwed;
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }
    }
}
